import request from "@/utils/request";

const LOG_BASE_URL = "/v3/manager/alarm";

class managerAlarmApi  {




  
  /**
   * 分页查询告警
   *
   */
  static alarmpage(queryParams: GetHistoricalDataParams) {
    return request<any,histype>({
      url: `${LOG_BASE_URL}/page`,
      method: "post",
      headers: {
        "Content-Type": "application/json",
      },
      data: queryParams,
    });
  }
  /**
   * 获取下拉列表
   *
   */
  static alarmoptions(Id: string) {
    return request<any,typeOptions[]>({
      url: `${LOG_BASE_URL}/options`,
      method: "get",
      params: {
        deviceTypeId: Id,
      },
    });
  }

  /**
   * 添加告警
   *
   */
static alarmsave(queryParams: SaveAlarmParams) {
  return request({
    url: `${LOG_BASE_URL}/save`,
    method: "post",
    headers: {
      "Content-Type": "application/json",
    },
    data: queryParams,
  });
}

  /**
   * 删除告警
   *
   */
  static alarmdelete(id:string) {
    return request({
      url: `${LOG_BASE_URL}/delete/${id}`,
      method: "DELETE",
      headers: {
        "Content-Type": "application/json",
      },
      // data: queryParams,
    });
  }

  /**
   * 修改告警
   *
   */
  static alarmupdate(queryParams: SaveAlarmParams) {
    return request({
      url: `${LOG_BASE_URL}/update`,
      method: "PUT",
      headers: {
        "Content-Type": "application/json",
      },
      data: queryParams,
    });
  }


}

export default managerAlarmApi;


// 参数接口
export interface SaveAlarmParams {
  /* */
  id?: string;

  /* */
  alarmName: string;

  /* */
  alarmCode: string;

  /*可用值:LEVEL_ONE,LEVEL_TWO,LEVEL_THREE,LEVEL_FOUR */
  level: string;

  /* */
  deviceTypeId: string;
}
// 参数接口
export interface GetHistoricalDataParams {
  /* */
  pages: {
    /* */
    current: number;

    /* */
    size: number;
    total: number;

    /* */
    startTime?: string;

    /* */
    endTime?: string;

    /* */
    orders?: {
      /* */
      column?: string;

      /* */
      asc?: boolean;
    }[];
  };

  /* */
 alarmName?: string;

  /* */
  alarmCode?: string;

  /*可用值:LEVEL_ONE,LEVEL_TWO,LEVEL_THREE,LEVEL_FOUR */
  level?: string;
}

export interface histype{
  headers: any;
  data: any;
  current: number;
  pages: number;
  records: Array<any>;
  size: number;
  total: number;

}



export interface alarmtype{
  "id"?: string,
  "alarmName": string,
  "alarmCode": string,
  "level": string,
  "deviceTypeId": string
}
export interface typeOptions {
  label: string;
  value: string;
}